export const namespace = "stadiumPath";
import record from "@/pages/marketing/record";
import { Image, Space } from "antd";

export const calcColumns = (params) => {
  const columns = [
    {
      title: "排序",
      dataIndex: "sort",
      width: 100,
      className: "drag-visible",
      hideInSearch: true,
    },
    {
      title: "ID",
      hidden: process.env.UMI_ENV == "prod" ? true : false,
      // width: 180,
      dataIndex: "id",
      hideInSearch: true,
    },
    {
      title: "指引标题",
      dataIndex: "pathName",
    },
    {
      title: "创建时间",
      dataIndex: "createTime",
      hideInSearch: true,
      //sorter: true,
    },
  ];

  if (params?.operate) {
    columns.push(params?.operate);
  }
  return columns;
};

export const calcColumns2 = (params) => {
  const columns = [
    {
      title: "路径描述",
      dataIndex: "videoDescribe",
      sortable: true,
    },
    {
      title: "图片指引",
      dataIndex: "picGuideUrl",
      render: (_, records) => {
        let { picGuideUrl } = records;
        return (
          <Space>
            <Image height={50} src={picGuideUrl} />
          </Space>
        );
      },
    },
    {
      title: "视频指引",
      dataIndex: "videoGuideUrl",
      render: (_, records) => {
        let { videoGuideUrl } = records;
        return (
          <Space>
            {videoGuideUrl && (
              <video
                src={videoGuideUrl}
                controls
                width={80}
                height={50}
              ></video>
            )}
          </Space>
        );
      },
    },
    {
      title: "排序值",
      dataIndex: "pathGuideSort",
    },
  ];
  if (params?.operate2) {
    columns.push(params?.operate2);
  }
  return columns;
};

export const calcColumns3 = (params) => {
  const columns = [
    {
      title: "排序",
      dataIndex: "sort",
      width: 100,
      className: "drag-visible",
      hideInSearch: true,
    },
    {
      title: "路径描述",
      dataIndex: "description",
      copyable: true,
      ellipsis: true,
    },
    {
      title: "图片描述",
      dataIndex: "picGuideUrl",
      valueType: "image",
      width: 180,
      render: (_, records) => {
        let { picGuideUrl } = records;
        return picGuideUrl && picGuideUrl.length > 0 ? (
          <Space>
            <Image height={80} src={picGuideUrl} />
          </Space>
        ) : (
          "-"
        );
      },
    },
  ];
  if (params?.operate) {
    columns.push(params?.operate);
  }
  return columns;
};
